<!--
  Copyright (c) 2021 Huawei Device Co., Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=edge chrome=1">
    <title>OHOSReport</title>
    <!-- import CSS -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>

<div id="report_title" v-bind:class="{ title_s : true}">
    <template>
        <div>
            <h4>{{ title }}</h4>
        </div>
    </template>
</div>

<div id="report_detail" v-bind:class="{ subsystem_table_style : true}" >
    <template>
        <el-table :data="tableData1" border size="mini"
                  empty-text="---"
                  :default-sort = "{prop: 'rate', order: 'ascending'}"
                  row-key="id"
                  :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
                  style="width: 100%">
            <el-table-column
                prop="Subsystem"
                fixed
                sortable
                label="Subsystem"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                prop="Testsuit"
                fixed
                sortable
                label="TestSuit"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                prop="Benchmark"
                sortable
                label="Benchmark"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                prop="Mode"
                sortable
                label="Mode"
                width="130"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                prop="RunType"
                sortable
                label="RunType"
                width="130"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                prop="Score"
                sortable
                label="Score"
                width="150"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                prop="Repetitions"
                sortable
                label="Repetitions"
                width="150"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                prop="detail"
                sortable
                label="Detail"
                width="100"
                show-overflow-tooltip
            >
                <template slot-scope="scope">
                    <a v-if="1>0" :href="getHrefPre(scope)+'_detail.html'" class="buttonText" v-bind:class="{ error_s : 1>0}">
                        {{ scope.row.detail }}
                    </a>
                    <label v-else for="detail">{{ scope.row.detail }}</label>
                </template>
            </el-table-column>
            <el-table-column
                prop="pm"
                label="PM"
                sortable
                show-overflow-tooltip
            >
            </el-table-column>
        </el-table>
    </template>
</div>

<div id="summary_title" v-bind:class="{ title_s : true}">
    <template>
        <div>
            <h4>{{ title }}</h4>
        </div>
    </template>
</div>

</body>

<!-- import Vue before Element -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>

<!-- report_title -->
<script>
    new Vue({
        el: '#report_title',
        data:
            { title : 'Microbenchmark Report'}
    })
</script>

<!-- report_detail -->
<script>
    new Vue({
        el: '#report_detail',
        data:{
            tableData1: OHOS_SUBSYSTEM_SUMMARY,
            enablepasslink:1
        },
        methods: {
            getHrefPre: function (scope)
            {
                if (scope.row.module === '---')
                {
                    return scope.row.subsystem
                }
                else
                {
                    return scope.row.Subsystem + '/' + scope.row.Module + '/' + scope.row.Testsuit + '/' + scope.row.Benchmark + '_' + scope.row.Mode
                }
            }
        }
    })
</script>

<style>
    .title_s {
        max-width: 1300px;
        margin: auto;
        background: white;
        height: 25px;
        color: #003399;
        padding: 10px 8px;
        text-align: center;
    }
    .error_s {
        color: #f00000;
        font-size: 14px;
    }
    .subsystem_table_style {
        max-width: 1300px;
        margin: auto;
        background: white;
        padding: 10px;
    }
    .el-table .warning-row {
        background: oldlace;
    }
    .el-table .failed-cell {
        color: #003399;
    }
    .el-table .success-row {
        background: #f0f9eb;
    }
    .el-table .header-row {
        color: #003399;
    }
</style>

</html>
